import { Entity, PrimaryGeneratedColumn, Column } from 'typeorm';

@Entity('users')
export class User {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ length: 50, unique: true })
  username: string;

  @Column({ length: 50, unique: true })
  nickname: string;

  @Column({ length: 100, unique: true })
  email: string;

  @Column({ length: 100, unique: true })
  phone: string;

  @Column({ length: 100, unique: true })
  carNumber: string;

  @Column({ length: 100 })
  password: string;

  @Column({ length: 255, nullable: true })
  image: string;

  @Column({ type: "enum", enum: ['Male', 'Female', 'Other'], nullable: true })
  gender: string;

  @Column({ length: 255, nullable: true })
  signature: string;

  @Column({ default: 0, comment: '助力次数' })
  rocketCount: number;

  @Column({ type: 'datetime', comment: '最后助力时间' })
  createdAt: Date;

  @Column({ type: 'datetime', comment: '更新时间' })
  upatedAt: Date;

  @Column('json', { nullable: true, default: null })
  collects: string[]; // 或者你可以定义一个类型来表示收藏内容

  @Column('json', { nullable: true, default: null })
  reports: string[]; // 或者你可以定义一个类型来表示举报内容

  @Column('json', { nullable: true, default: null })
  rocket: string[]; // 或者你可以定义一个类型来表示助力内容
}
